<?php


namespace PackageSpy;

class MailInfoService {
	
	/**
	 * Sends info about changed package
	 * @param PackageInfo $packageInfo
	 * FIXME dodelat
	 */
	public function sendMailPackageStatusChanged(PackageInfo $packageInfo){
		$template = new \Nette\Templating\FileTemplate(__DIR__ ."/../../templates/email/emailStatusChanged.latte");
		$template->registerFilter(new \Nette\Latte\Engine);
		$template->registerHelperLoader('Nette\Templating\Helpers::loader');
		$template->packageInfo = $packageInfo;
		
		$mail = new \Nette\Mail\Message();
		$mail->setFrom('Gusta GUstavson <premysl.cimbalek@gmail.com>')
		->setSubject("Predmet mailu")
		->addTo("premysl.cimbalek@gmail.com", "Přemysl Cimbálek")
		->setHtmlBody($template);
		
		/* only for testing if theres no provider smtp 
		 * $mailer = new \Nette\Mail\SmtpMailer(array(
				'host' => 'smtp.gmail.com',
				'username' => 'premysl.cimbalek@gmail.com',
				'password' => '***',
				'secure' => 'ssl',
		));
		$mail->setMailer($mailer); */
		$mail->send();
	}
}

